//
//  JMHomeNoVerifyView.m
//  NewiOSProject
//
//  Created by JMMac on 24.12.23.
//  Copyright © 2023 范智渊. All rights reserved.
//

#import "JMHomeNoVerifyView.h"
#import "JMHomeCloudunView.h"
#import "JMAuthVC.h"


@implementation JMHomeNoVerifyView

-(instancetype)initWithNeedCloudun:(BOOL)isNeed{
    if (self = [super init]) {
        self = [[UIView alloc]initWithFrame:(CGRectMake(0, 0, kAppW(), 20))];
        UIImageView *topImgV = [[UIImageView alloc]initWithFrame:(CGRectMake(0, 0, kAppW(), 202))];
        [topImgV setImage:ImageNamed(@"home_top")];
        [self addSubview:topImgV];
        
        UIImageView *logoImgV = [[UIImageView alloc]initWithFrame:(CGRectMake(24, kSafeAreaTopHeight()+10, 32, 32))];
        [logoImgV setImage:ImageNamed(@"login_Logo")];
        [self addSubview:logoImgV];
        
        
        UILabel *Lab = [JMControl createLabelWithFrame:(CGRectMake(24, topImgV.height-65, kAppW(), 65)) Font:fontWithWeight(24, UIFontWeightMedium) Text:@"Bienvenido a \nMóvil Loan" color:WhiteColor()];
        [self addSubview:Lab];
        
        UILabel *maxLab = [JMControl createLabelWithFrame:(CGRectMake(0, topImgV.bottom+17, kAppW(), 25)) Font:Font(17) Text:@"Cuota máxima($)" color:Hex_Str_COLOR(@"#222222")];
        maxLab.textAlignment = 1;
        [self addSubview:maxLab];
        
        UILabel *wenhaoLab = [JMControl createLabelWithFrame:(CGRectMake(0, maxLab.bottom+30, kAppW(), 51)) Font:fontWithWeight(36, UIFontWeightBold) Text:@"???" color:Hex_Str_COLOR(@"#3C57F8")];
        wenhaoLab.textAlignment = 1;
        [self addSubview:wenhaoLab];
        
        UILabel *timeLab = [JMControl createLabelWithFrame:(CGRectMake(24, wenhaoLab.bottom+30, kAppW(), 20)) Font:fontWithWeight(15, UIFontWeightMedium) Text:@"120 Días" color:Hex_Str_COLOR(@"#555555")];
        [self addSubview:timeLab];
        
        UILabel *timeRightLab = [JMControl createLabelWithFrame:(CGRectMake(kAppW()-135, timeLab.top, 100,timeLab.height)) Font:timeLab.font Text:@"0.05% Por día" color:timeLab.textColor];
        [self addSubview:timeRightLab];
        
        UILabel *timeTitleLab = [JMControl createLabelWithFrame:(CGRectMake(24, timeLab.bottom+8, kAppW(), 20)) Font:fontWithWeight(15, UIFontWeightRegular) Text:@"Plazo de préstamo " color:Hex_Str_COLOR(@"#666666")];
        [self addSubview:timeTitleLab];
        
        UILabel *timeRightTitleLab = [JMControl createLabelWithFrame:(CGRectMake(kAppW()-135, timeTitleLab.top, 100,timeTitleLab.height)) Font:timeTitleLab.font Text:@"Tasa de Interés" color:timeTitleLab.textColor];
        [self addSubview:timeRightTitleLab];
        
        
        UIButton *SiguienteBtn = [JMControl createButtonWithFrame:(CGRectMake(24, timeTitleLab.bottom+30, kAppW()-48, 56)) Target:self Action:nil Title:@"Siguiente" titlColor:WhiteColor() font:fontWithWeight(17, UIFontWeightMedium) tag:1 backgroundColor:Button_ENABLE_BG_COLOR()];
        @weakify(self);
        [SiguienteBtn tapAction:^(UIView *sender) {
            @strongify(self);
                    JMAuthVC *vc = JMAuthVC.new;
                    [self.viewController.navigationController pushViewController:vc animated:YES];
        }];
        SiguienteBtn.cornerRadius = 28;
        [self addSubview:SiguienteBtn];
        
        UILabel *soloLab = [JMControl createLabelWithFrame:(CGRectMake(0, SiguienteBtn.bottom+24, 150, 24)) Font:fontWithWeight(17, UIFontWeightMedium) Text:@"Solo tres pasos" color:Hex_Str_COLOR(@"#222222")];
        [self addSubview:soloLab];
        soloLab.backgroundColor = WhiteColor();
        soloLab.textAlignment = 1;
        soloLab.centerX = kAppW()/2;
        
        UIView *lineV = [[UIView alloc]initWithFrame:(CGRectMake(0, 0, 198, 2))];
        lineV.backgroundColor = Hex_Str_COLOR(@"#3C57F8");
        [self addSubview:lineV];
        [self sendSubviewToBack:lineV];
        lineV.center = soloLab.center;
        
        NSArray *titles = @[@"Autenticación",@"Revision rapida",@"Depósito inmediato"];
        for (int i=0; i<3; i++) {
            UIButton *iconBtn = [JMControl createButtonWithFrame:(CGRectMake(kAppW()/3*i, soloLab.bottom+30, kAppW()/3+80, 90)) ImageName:[NSString stringWithFormat:@"home_icon%ld",i+1] Target:self Action:nil font:Font(12) Title:titles[i]];
            [iconBtn setTitleColor:Hex_Str_COLOR(@"#666666") forState:(UIControlStateNormal)];
            iconBtn.tag = i;
            [self addSubview:iconBtn];
            [iconBtn TiaoZhengButtonWithOffsit:20 TextImageSite:(UIButtonTextBottom)];
   
            iconBtn.centerX = kAppW()/3*i+kAppW()/6;
            if(i<2){
                UIImageView *arrowBtn = [[UIImageView alloc]initWithFrame:(CGRectMake(0, 0, 24, 24))];
                [arrowBtn setImage:ImageNamed(@"home_arrow")];
                [self addSubview:arrowBtn];
                arrowBtn.centerY = iconBtn.centerY-17;
                arrowBtn.centerX = kAppW()/3*(i+1);
            }
        }
        JMHomeCloudunView* cloundunView = [[JMHomeCloudunView alloc]initWithFrame:(CGRectMake(9, SiguienteBtn.bottom+168, kAppW()-18, ScaleW(119)))];
        [self addSubview:cloundunView];
        
        self.height = cloundunView.bottom;
    }
    
    return self;
}

@end
